package com.example.demo_service.controller;

import com.alibaba.cloud.ai.dashscope.rag.DashScopeDocumentCloudReader;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.ai.document.Document;
import org.springframework.ai.document.DocumentReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

import java.util.List;

@RestController
@RequestMapping("/test")
public class TestController {


//    public String buildIndex() {
//        String filePath = "/path/to/your/alibaba_financial_report.pdf";
//        DocumentReader reader = new DashScopeDocumentCloudReader(filePath, dashscopeApi, null);
//        List<Document> documentList = reader.get();
//        vectorStore.add(documentList);
//        return "SUCCESS";
//    }
//
//    @GetMapping("/steamChat")
//    public Flux<String> generate(@RequestParam("input") String message, HttpServletResponse httpResponse) {
//        StreamResponseSpec chatResponse = ragService.queryWithDocumentRetrieval(message);
//        httpResponse.setCharacterEncoding("UTF-8");
//        return chatResponse.content();
//    }


}
